package com.sh169.util;

import java.io.IOException;
import java.util.Properties;

import org.nutz.log.Log;
import org.nutz.log.Logs;


public class ApplicationUtil {

	private static String webHomePath;
	private static String mailHost;
	private static String username;
	private static String password;
	
//	static {
//		String prefixClassPath = ApplicationUtil.class.getResource("/").toString();
//		String classPath = prefixClassPath.substring("file:/".length());
//		webHomePath = new File(classPath).getParentFile().getParentFile().getAbsolutePath();
//	}
	private static Log log = Logs.getLog(ApplicationUtil.class);
	private static Properties pp = new Properties();
	static {
		try {
			pp.load(ApplicationUtil.class.getResourceAsStream("/mail.properties"));
			mailHost = pp.getProperty("mail.smtp.host","smtp.126.com");
			username = pp.getProperty("mail.username","feiyan35488@126.com");
			password = pp.getProperty("mail.password","3548834239");
		} catch (IOException e) {
			log.error(e);
		}
	}
	public static String getWebHomePath(){
		System.out.println(webHomePath);
		return webHomePath;
	}
	public static void setWebHomePath(String webHomePath){
		ApplicationUtil.webHomePath = webHomePath;
	}
	
	public static void main(String[] args) {
		System.out.println(webHomePath);
	}
	public static String getMailHost() {
		return mailHost;
	}
	public static void setMailHost(String mailHost) {
		ApplicationUtil.mailHost = mailHost;
	}
	public static String getUsername() {
		return username;
	}
	public static void setUsername(String username) {
		ApplicationUtil.username = username;
	}
	public static String getPassword() {
		return password;
	}
	public static void setPassword(String password) {
		ApplicationUtil.password = password;
	}
}
